Skip to content

GPT models via an on-demand local translation proxy - #7

Merged
BeLazy167 merged 1 commit into
mainfrom
feat/gpt-models-via-proxy
Aug 20, 2026
Merged

GPT models via an on-demand local translation proxy#7
BeLazy167 merged 1 commit into
mainfrom
feat/gpt-models-via-proxy

Conversation

@BeLazy167

Copy link
Copy Markdown
Member

The gateway serves 8 GPT models (gpt-5.6-sol, gpt-5.4-mini, …) that Claude
Code cannot reach: it speaks Anthropic Messages, and they live only on the
OpenAI-compat surface. This closes that gap without touching the gateway:

qbraid-code --model gpt-5.6-sol

How

A loopback CLIProxyAPI on port 8320 translates Anthropic Messages ↔
chat-completions — the pattern proven in a spike earlier today, including
agentic tool use. The installer sets it up (existing binary → Homebrew →
release download), generates its config from the gateway's live model list,
and the launcher starts it only when a gpt-* model is actually requested.
Claude models keep the direct path and never depend on the proxy. Everything is
non-fatal: if proxy setup fails, Claude models still work and the error says
how to fix it.

Verified live (fresh delete + reinstall)

Step Result
install proxy configured for 8 GPT models (starts on demand)
qbraid-code -p (claude, direct)
--model gpt-5.6-sol (proxy auto-start)
--model gpt-5.4-mini (proxy reuse)
--doctor / --stop proxy state reported, clean shutdown

tests/model-routing.sh (6 cases) pins the model-selection logic against the
real function definition; all suites green, shellcheck clean, bash 3.2 parse OK.

Caveats stated in the README

  • GPT models cap tools at 128 — heavy MCP setups need --strict-mcp-config.
  • The in-session /model picker is Claude Code's own UI and lists Claude
    models only; GPT is chosen at launch with --model.
  • Windows scripts (qbraid-proxy.ps1, .cmd changes) are reviewed + CI-parsed
    but not executed — same standing gap as the rest of the Windows half.
  • qbraid-external-site#107's companion allowlist needs qbraid-proxy.ps1
    added (done on that branch).

Claude Code speaks the Anthropic Messages API; the gateway serves its 8 GPT
models only on the OpenAI-compat surface. A loopback CLIProxyAPI (port 8320)
translates between the two.

- Installer: installs CLIProxyAPI (existing binary > Homebrew > release
  tarball / windows zip), fetches the live gpt-* list from /models, and
  writes proxy-config.yaml (mode 600 — it holds the API key) plus a local
  bearer in proxy.key. Non-fatal throughout: Claude models never depend on it.
- Launcher: `--model gpt-*` (or a gpt default) starts the proxy on demand and
  points Claude Code at it; Claude models keep the direct path. An explicit
  --model wins over the configured default. `--stop` kills the proxy;
  --doctor reports its state.
- Windows: qbraid-proxy.ps1 (ensure|status|stop) owns the lifecycle; the .cmd
  detects the requested model and delegates.

Verified live on a fresh delete+reinstall: claude-sonnet direct, gpt-5.6-sol
auto-starting the proxy, gpt-5.4-mini reusing it, stop, doctor. GPT models
cap tools at 128, so heavy MCP setups need --strict-mcp-config (README'd).

tests/model-routing.sh pins requested_model() against the real definition;
wired into CI with the others.
@BeLazy167
BeLazy167 merged commit 8c86317 into main Aug 20, 2026
6 checks passed
@BeLazy167
BeLazy167 deleted the feat/gpt-models-via-proxy branch August 20, 2026 23:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant